package com.ytjj.qmyx.mall.enums;

import com.kuaidi100.sdk.enums.ExpressEnums;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum  AliPayComplaintsStatusEnums {
    MERCHANT_PROCESSING("MERCHANT_PROCESSING","待处理"),
    MERCHANT_FEEDBACKED("MERCHANT_FEEDBACKED","已处理"),
    FINISHED("FINISHED","投诉完结"),
    CANCELLED("CANCELLED","投诉关闭"),
    PLATFORM_PROCESSING("PLATFORM_PROCESSING","客服处理中"),
    PLATFORM_FINISH("PLATFORM_FINISH","客服处理完结"),
    CLOSED("CLOSED","审核不通过");

    private String code;

    private String msg;


    AliPayComplaintsStatusEnums(String code, String msg){
        this.code = code;
        this.msg = msg;
    }


    public static String getMsg(String code) {
        AliPayComplaintsStatusEnums[] values = AliPayComplaintsStatusEnums.values();
        for(AliPayComplaintsStatusEnums enums : values){
            if(enums.getCode().equals(code)){
                return enums.getMsg();
            }
        }
        return null;
    }

    /**
     * 是否可以自动回复
     * @param code
     * @return
     */
    public static boolean isAutoReply(String code){
        Map<String,String> map = new HashMap<>();
        //待处理
        map.put(AliPayComplaintsStatusEnums.MERCHANT_PROCESSING.getCode(),MERCHANT_PROCESSING.getMsg());
        //客服处理中
        map.put(AliPayComplaintsStatusEnums.PLATFORM_PROCESSING.getCode(),PLATFORM_PROCESSING.getMsg());;

        if(null != map.get(code) && !"".equals(map.get(code))){
            return true;
        }
        return false;
    }
}
